﻿using PracticeCentre.Business;
using PracticeCentre.Common;
using PracticeCentre.Modeles;
using PracticeCentre.Mvc.Filters;
using PracticeCentre.Mvc.Helper;
using PracticeCentre.Mvc.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace PracticeCentre.Mvc.Controllers
{
    public class EmploymentController : BaseController
    {
        private JsonResult result;
        [LoginIntercept]
        public ActionResult List()
        {
            return View();
        }

        [LoginIntercept]
        [HttpPost]
        //public ActionResult List(PageViewModel model)
        //{
        //    //将视图数据映射到业务逻辑数据
        //    //PageModel<RecruitmentPlan> pagemodel = ModelesMapping.Mapping<PageModel<RecruitmentPlan>, PageViewModel>(model);
        //    //Recruitment recruitment = new Recruitment();
        //    ////查询数据列表
        //    //pagemodel = recruitment.GetPlanList(pagemodel);
        //    //string data = JsonTool.JsonSerializer(pagemodel);
        //    //result = DataHelper.GetResult(ExecuteState.Succeed, "获取列表成功！", data);
        //    //return result;
        //}

        [LoginIntercept]
        public ActionResult Add()
        {
            return View();
        }


        [LoginIntercept]
        public ActionResult MakePlan()
        {
            return View();
        }

        [LoginIntercept]
        [HttpPost]
        public ActionResult MakePlan(RecruitmentPlan model)
        {
            Recruitment recruitment = new Recruitment();
            bool succeed = recruitment.MakePlan(model);
            if (succeed)
            {
                result = DataHelper.GetResult(ExecuteState.Succeed, "计划添加成功！","");
            }
            else
            {
                result = DataHelper.GetResult(ExecuteState.Failed, "计划添加失败！", "");
            }
            return View();
        }
    }
}